package com.frontop.system.modules.app.controller;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.frontop.common.annotation.AnonymousAccess;
import com.frontop.common.util.ResultJsonUtil;
import com.frontop.system.modules.app.model.AppRecommend;
import com.frontop.system.modules.app.model.AppVersion;
import com.frontop.system.modules.app.service.AppVersionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * app版本表 前端控制器
 * </p>
 *
 * @author YangJia
 * @since 2022-06-20
 */
@RestController
@RequestMapping("/app-version")
public class AppVersionController {

    @Autowired
    AppVersionService appVersionService;


    @ApiOperation(value = "查询最新app版本号")
    @GetMapping("/getNewApkVersion")
    @AnonymousAccess
    public ResultJsonUtil<Object> getNewApkVersion() {
        QueryWrapper<AppVersion> queryWrapper = new QueryWrapper<>();
        queryWrapper.orderByDesc("create_time");
        queryWrapper.last("limit 0,1");
        AppVersion appVersion = appVersionService.getOne(queryWrapper);
        return new ResultJsonUtil().success(appVersion);
    }

}